/**
 * SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
 * SPDX-License-Identifier: Mulan PSL v2
 */
<template>
    <sf-form-item class="instance_number__form">
        <sf-fieldlabel :class="{'p-l0':leftClass}">
            <lang>实例范围</lang>
        </sf-fieldlabel>
        <div class="instance-flex">
            <sf-numberfield 
                v-model="submitData.minReplicas"
                :default-width="width"
                :allow-blank="false"
                :allow-decimals="false"
                :min-value="1"
                :placeholder="_('最小实例个数')" />
            <span class="m-lr10"><lang>至</lang></span>
            <sf-numberfield 
                v-model="submitData.maxReplicas"
                :default-width="width"
                :min-value="1"
                :max-value="1000"
                :allow-blank="false"
                :allow-decimals="false"
                :placeholder="_('最大实例个数')" />
        </div>
    </sf-form-item>
</template>

<style lang="less">
.instance_number__form {
    display: flex;
    .instance-flex{
        display: flex;
        align-items:center;
        margin-left:4px;
    }
}
</style>

<script>
export default {
    props:{
        width:{
            type:[String, Number],
            default:152
        },
        leftClass:{
            type:Boolean,
            default:true
        },
        submitData:{
            type:Object,
            default:()=>{
                return {
                    minReplicas:1,
                    maxReplicas:1
                };
            }
        }
    },
    data () {
        return {

            // submitData:{
            //     minReplicas:1,
            //     maxReplicas:''
            // }
        };
    },
  
    methods: {
        setJsonValue (data) {
            Object.assign(this.submitData, data);
        },
        getJsonValue () {
            return this.submitData;
        }
    }
};
</script>
